<template>
  <Created @handlePlan="handlePlan"></Created>
</template>
<script lang="ts">
  import { defineComponent } from "vue";
  import { useStore } from "vuex";
  import Created from "./component/create.vue";
  import * as types from "@/store/action.type";
  import { message } from 'ant-design-vue';
  import { IGlobalState } from "@/store/index";
  import { IData } from "./plan.types";
  export default defineComponent({
    name: "Plan",
    components: {
      Created,
    },
    setup(props, context) {
      const store = useStore<IGlobalState>();
      const handlePlan = async (plan: IData) => {
        await store.dispatch(types.ADD_PLAN, plan);
        message.success("操作成功");
      };
      return {
        handlePlan,
      };
    },
  });
</script>
